<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>5秒倒计时</title>
    <style>
        #countdown {
            font-size: 30px;
            text-align: center;
            margin-top: 50px;
        }
    </style>
</head>

<body>
    <div id="countdown"></div>
    <script>
        const countdownElement = document.getElementById('countdown');
        let seconds = 5;

        function updateCountdown() {
            countdownElement.innerHTML = seconds;
            if (seconds > 0) {
                seconds--;
                setTimeout(updateCountdown, 1000);
            }
        }

        updateCountdown();
    </script>
</body>

</html>